Conversation
| // ACTION REQUIRED: This file was automatically added to your project, but it | ||
| // will not take effect until additional steps are taken to enable it. See the | ||
| // following page for additional information: |
There was a problem hiding this comment.
Тут говорится, что надо конфигурацию применить и удалить этот комментарий
| [*.cs] | ||
|
|
||
| # SA1600: Elements should be documented | ||
| dotnet_diagnostic.SA1600.severity = none |
There was a problem hiding this comment.
Это стоило выключать только для тестов, для всего проекта не надо
| // Copyright (c) Kalinin Andrew. All rights reserved. | ||
| // </copyright> | ||
|
|
||
| namespace NullElements.Tests |
There was a problem hiding this comment.
Используйте file-scoped namespaces, так сейчас не пишут уже
| { | ||
| var testList = new MyList<string>(); | ||
| testList.Add("hello"); | ||
| testList.Add(null); |
There was a problem hiding this comment.
Тут стоило явно заглушить предупреждения nullability, хотя бы с помощью оператора !. Потому что собираться должно без предупреждений.
| { | ||
| if (list == null) | ||
| { | ||
| throw new ArgumentNullException(nameof(list)); |
There was a problem hiding this comment.
ArgumentNullException.ThrowIfNull
| { | ||
| for (int i = 0; i < this.count; ++i) | ||
| { | ||
| yield return this.items[i]; |
There was a problem hiding this comment.
Так оно не будет проверять на то, что список не поменялся. Можно было просто запомнить count в локальной переменной и на каждой итерации сравнивать её с текущим count
| IEnumerator IEnumerable.GetEnumerator() | ||
| { | ||
| return this.GetEnumerator(); | ||
| } |
No description provided.